% How many inhibitory neurons do I need in order to be sure that there is a
% path from one excitatory neuron to any other excitatory neuron through a
% basket cell.  This is important for network stability; it is absolutely
% required to maintain balanced E/I.  Suppose there was no path from P1 to
% P2 via an inhibitory neuron, yet P1 had an excitatory connection to P2.
% This would allow unbalanced excitatory conductance increases in P2.  Bad.
%function chance = ei_balance_probability(ni,petoi,pitoe)
function chance = ei_balance_probability(ni,petoi,pitoe)
    p_no_path_to_i = (1-petoi);
    p_no_path_to_e = (1-pitoe);
    chance=1-(p_no_path_to_i+p_no_path_to_e - p_no_path_to_i*p_no_path_to_e )^ni

% We would also like to make sure that there is no inhibitory path from I1
% to P1 that cannot be balanced with excitation?  Not a problem since
% excitation already exists, else the net would be quiet.

% Other problem: you have to make sure that E->I is strong enough to cause
% I to fire, else balance is lost.  Then you have to have learning at both
% E and I synapses of a principal cell in order to maintain E/I balance,
% which has been demonstrated in vivo [Nicolas et al, 2008].

% Explains why we can't have the same ratio of E/I in all cells, since the
% inhib neurons are shared? Nicolas et al actually showed that cells had
% about the same balance.  Paper by ?? showed developmental regulation of
% the balance happened in tadpole tectum; glu seamed to activate learning
% and the inhibition kept up.  Both inh and exc inputs saturated and for
% the most part ended with ratios of 1:2 to 1:3.5 for E:I.